<?php
	if(!isset($_REQUEST['ajax'])){ $_REQUEST['ajax'] = "";}
	if($_REQUEST['ajax']!=true) include 'header.tpl.php';
?>
	<div class="row">
    	<div class="col-lg-12">
    		<ul class="shortcut-buttons-set">
				<li>
					<a class="shortcut-button" href='#salary_list'><span>
					<i class="aicon-task_list"></i>
					<?php echo $this->language['salaries'];?></span></a>
				</li>
				<li>
					<a class="shortcut-button" href='#import_salary'><span>
					<i class="aicon-import"></i>
					<?php echo $this->language['import_salary'];?></span></a>
				</li>
				<li>
					<a class="shortcut-button" href='#salary_formula'><span>
					<i class="aicon-salary_formula"></i>
					<?php echo $this->language['salary_formula'];?></span></a>
				</li>
			</ul>
    	</div>
    </div>
    <div class="row">
    	<div class="col-lg-12">
    		<div class="panel">
    			<div class="panel-heading">
    				<div class="panel-title"><i class="icon-list"></i> <?php echo $this->cTitle;?></div>
    			</div>
    			<div class="panel-body">
    				<form action="javascript:searchSalary();" class="form-inline">
						<label><?php echo $this->language['choose'];?> : </label>
						<select id="sal_month" class="form-control">
							<?php for($i=1;$i<=12;$i++){
							$selected = ($i==date("n",time())) ? "selected" : "";
							echo "<option value='$i' $selected>Tháng $i</option>";
							} ?>
						</select>
						<select id="sal_year" class="form-control">
							<?php for($i=2012;$i<=2020;$i++){
							$selected = ($i==date("Y",time())) ? "selected" : "";
							echo "<option value='$i' $selected>$i</option>";
							} ?>
						</select>
						<button class="btn btn-warning" type="submit"><?php echo $this->language['search'];?></button>
					</form>
					<div class="clear"></div>
		            <table class="table table-fixed table-hover table-condensed">
						<thead>
							<tr>
								<th width='150px'><?php echo $this->language['name'];?></th>
								<th width='130px'><?php echo $this->language['departments'];?></th>
								<th>Tổng thu nhập</th>
								<th>Tổng thực nhận</th>
								<th>Lương kinh doanh</th>
		                        <th>Lương thực nhận</th>
								<th width='90px'><?php echo $this->language['action'];?></th>
							</tr>
						</thead>
						<tbody>
							<?php if(isset($this->users)){
								foreach($this->users as $row){ ?>
							<tr>
								<td><a href="#salary_view/id=<?php echo $row['uId'];?>"><?php echo $_SESSION['user_data'][$row['user_id']]['fullname'];?></a></td>
								<td><?php echo $_SESSION['user_data'][$row['user_id']]['room_name'];?></td>
								<td><font color=green><?php echo number_format($row['tong_thu_nhap'],0,'.',',');?></font></td>
		                        <td><font color=red><?php echo number_format($row['thuc_lanh'],0,'.',',');?></font></td>
								<td><font color=purple><?php echo number_format($row['kinh_doanh'],0,'.',',');?></font></td>
		                        <td><font color=red><?php echo number_format($row['luong_thuc_nhan'],0,'.',',');?></font></td>
								<td><a href='#salary_view/id=<?php echo $row['user_id'];?>' title="Xem chi tiết"><img src="resources/images/icons/view.png" /></a></td>
							</tr>
							<?php }} ?>
						</tbody>
						<?php if(isset($this->tfoot)) echo $this->tfoot;?>
					</table>
    			</div>
    		</div>
    	</div>
    </div>
<?php if(isset($this->breadcrumb) && isset($this->title_header)):?>
	<script type="text/javascript">
		$(function() {
			$("#title-header").text('<?php echo $this->title_header;?>');
			$("#breadcrumb").html('<?php echo build_breadcrumb($this->breadcrumb);?>');
		});
	</script>
<?php endif;?>
<?php
	if($_REQUEST['ajax']!=true) include 'footer.tpl.php';
?>